﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"  
        xmlns:patterns="clr-namespace:PT.Patterns;assembly=PT.Patterns"
        x:Class="PT.UI.Windows.MainWindow"
        x:Name="WindowInstance"
        Title="Rhythm Friend" Height="262" Width="534" Icon="/PT.UI.Windows;component/Images/AudioFile.png">
    <Window.Resources>
        <ObjectDataProvider x:Key="PatternDataSource" ObjectType="{x:Type patterns:Rudiments}" MethodName="get_List" />
        <SolidColorBrush x:Key="BorderBrush" Color="#FF333333"/>
    </Window.Resources>
    <Grid Background="{StaticResource WindowBackgroundBrush}">
        <Border BorderThickness="1" Height="45" Width="59" Padding="3" CornerRadius="3" Background="{StaticResource ControlBackgroundBrush}" Margin="259,12,0,0" 
                HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="{StaticResource SolidBorderBrush}">
            <Grid>
                <Grid.RowDefinitions>
                	<RowDefinition Height="Auto" />
                	<RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                	<ColumnDefinition Width="*" />
                	<ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Label Content="Beat: " Grid.Row="0" Grid.Column="0" />
                <Ellipse x:Name="beatLed" Height="16" Width="16" Grid.Row="0" Grid.Column="1" Margin="1" Fill="#FF888888" />
                <Label Content="Note: " Grid.Row="1" Grid.Column="0" />
                <Ellipse x:Name="noteLed" Height="16" Width="16" Grid.Row="1" Grid.Column="1" Margin="1" Fill="#FF888888" />
            </Grid>
        </Border>
        <Border x:Name="AccuracyBorder" Height="45" Width="140" BorderThickness="1" CornerRadius="2" 
            HorizontalAlignment="Left" VerticalAlignment="Top" Background="#FF333333" BorderBrush="{StaticResource SolidBorderBrush}" Margin="324,12,0,0">
            <Canvas x:Name="AccuracyCanvas" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ClipToBounds="True">
                <Line X1="70" X2="70" Y1="0" Y2="45" Stroke="AliceBlue"/>
            </Canvas>
        </Border>
        <Border x:Name="DynamicsBorder" Height="45" Width="33" BorderThickness="1" CornerRadius="2" 
            HorizontalAlignment="Left" VerticalAlignment="Top" Background="#FF333333" BorderBrush="{StaticResource SolidBorderBrush}" Margin="469,12,0,0">
            <Canvas x:Name="DynamicsCanvas" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ClipToBounds="True"/>
        </Border>
        <Border x:Name="IndicatorBorder" Height="200" Width="240" BorderThickness="1" CornerRadius="2" 
                HorizontalAlignment="Left" VerticalAlignment="Top" 
                BorderBrush="{StaticResource SolidBorderBrush}" Background="#FF333333" Margin="8,12,0,0">
    		<Canvas x:Name="IndicatorCanvas" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ClipToBounds="True" >
    			<Rectangle x:Name="Arrow" 
    				Canvas.Left="114" Canvas.Top="240" Height="160" Width="6" 
    				Fill="{StaticResource TextBrush}" RenderTransformOrigin="0.5,0" >
    				<Rectangle.RenderTransform>
						<RotateTransform x:Name="Rotation" Angle="180"/>
    				</Rectangle.RenderTransform>
    			</Rectangle>
    			<Ellipse x:Name="IndicatorScale" Height="340" Canvas.Left="-53.334" Canvas.Top="69" Width="340" Stroke="#FF898989"/>
                <Rectangle Width="1" Height="10" Canvas.Left="116.5" Canvas.Top="239" Fill="#FF898989">
                    <Rectangle.RenderTransform>
                        <TransformGroup>
                            <TranslateTransform X="0" Y="-175"/>
                            <RotateTransform Angle="-41.5"/>
                        </TransformGroup>
                    </Rectangle.RenderTransform>
                </Rectangle>
                <Rectangle Width="1" Height="10" Canvas.Left="116.5" Canvas.Top="239" Fill="#FF898989">
                    <Rectangle.RenderTransform>
                        <TransformGroup>
                            <TranslateTransform X="0" Y="-175"/>
                            <RotateTransform Angle="41.5"/>
                        </TransformGroup>
                    </Rectangle.RenderTransform>
                </Rectangle>
            </Canvas>
    	</Border>
        <GroupBox Header="Metronome" Height="105" HorizontalAlignment="Left" Margin="259,107,0,0" VerticalAlignment="Top" Width="244" BorderBrush="{StaticResource SolidBorderBrush}">
            <Grid>
                <TextBox Background="{StaticResource NormalBrush}" HorizontalAlignment="Left" Margin="3,5,0,0" TextWrapping="Wrap" VerticalAlignment="Top" MaxLength="3" Width="40" IsReadOnly="True" IsReadOnlyCaretVisible="False" Text="{Binding Tempo, ElementName=WindowInstance}" Height="36" FontSize="18" VerticalContentAlignment="Center" />
                <Button x:Name="TempoIncreaseButton" Width="40" Height="18" Margin="52,5,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Click="TempoIncreaseButtonOnClick">
                    <Polygon Points="0, 8 16,8 8,0" Fill="White" VerticalAlignment="Top" HorizontalAlignment="Right" />
                </Button>
                <Button x:Name="TempoDecreaseButton" Width="40" Height="18" Margin="52,23,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" Click="TempoDecreaseButtonOnClick">
                    <Polygon Points="0, 0 16,0 8,8" Fill="White" VerticalAlignment="Top" HorizontalAlignment="Right" />
                </Button>
                <Button x:Name="TapTempo" Content="Tap" Height="36" HorizontalAlignment="Left" Margin="94,5,0,0" VerticalAlignment="Top" Width="43" PreviewMouseDown="TapTempoOnMouseDown" />
                <Button x:Name="MetronomeControlButton" Content="Start" Width="89" Height="36" Margin="0,5,0,0" HorizontalAlignment="Right" VerticalAlignment="Top" MouseEnter="MetronomeControlButtonOnMouseEnter" MouseLeave="MetronomeControlButtonOnMouseLeave" Click="MetronomeControlButtonOnClick" />
                <Border Height="24" Margin="52,47,2,3" BorderBrush="{StaticResource SolidBorderBrush}" CornerRadius="2" BorderThickness="1">
                    <ComboBox x:Name="PatternDropDown"  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" DataContext="{StaticResource PatternDataSource}" ItemsSource="{Binding}" SelectionChanged="PatternDropDownOnSelectionChanged" BorderThickness="2" BorderBrush="{StaticResource SolidBorderBrush}" />
                </Border>
                <Label Content="Pattern: " Height="28" Margin="4,51,0,-5" HorizontalAlignment="Left" Width="44" />
            </Grid>
        </GroupBox>
        <Border Height="40" Margin="258,62,0,121" Background="{StaticResource ControlBackgroundBrush}" HorizontalAlignment="Left" Width="245" CornerRadius="2" BorderThickness="1" BorderBrush="{StaticResource SolidBorderBrush}">
            <Grid>
                <Label Content="Note detection: " Height="28" BorderBrush="{StaticResource BorderBrush}" Margin="4,11,-4,-1" />
                <Button x:Name="DetectorControlButton" Content="Start" Height="28" HorizontalAlignment="Left" Margin="149,5,0,0" VerticalAlignment="Top" Width="89" Click="DetectorControlButtonOnClick" />
            </Grid>
            
        </Border>
    </Grid>
</Window>
